
import cgi;
import cgitb; cgitb.enable();
import os;
from google.appengine.ext.webapp import template;

from google.appengine.ext import webapp;
from google.appengine.ext.webapp.util import run_wsgi_app;

from google.appengine.ext import db


class UserApplications(db.Model):
	url = db.TextProperty();
	title = db.StringProperty();
	date = db.DateTimeProperty(auto_now_add=True);


class MainPage(webapp.RequestHandler):
	def get(self):
		url = 'google.com';
		url_linktext = 'Logout'
		userApplications = db.GqlQuery("SELECT * FROM UserApplications");
			      
		template_values = {
			'userApplications': userApplications,
		};
		path = os.path.join(os.path.dirname(__file__), 'index.tpl');

		self.response.out.write(template.render(path, template_values));

application = webapp.WSGIApplication(
					[('/index.html', MainPage)],
					debug=True);

def main():
	run_wsgi_app(application);



if __name__ == "__main__":
	main();
